// @Author EthanScriptOn
// @Desc
package extend_param_collector

import "github.com/apache/rocketmq-client-go/v2/primitive"

type RocketmqProducerParams struct {
	Params []*RocketmqProducerParam
}

type RocketmqProducerParam struct {
	Topic          string
	Body           []byte
	CompressedBody []byte
	Flag           int32
	TransactionId  string
	Batch          bool
	Compress       bool
	Queue          *primitive.MessageQueue
}

func (r *RocketmqProducerParams) IsValid() bool {
	if len(r.Params) <= 0 {
		return false
	}
	for _, param := range r.Params {
		if !param.IsValid() {
			return false
		}
	}
	return true
}

func (r *RocketmqProducerParam) IsValid() bool {
	return r.Topic != "" && len(r.Body) != 0
}
